<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #box {
            width: 100px;
            height: 100px;
            background: red;
            position: absolute;
        }
    </style>
</head>

<body>
    <div id="box"></div>
    <script>
        // document.onkeydown = function(event) {
        //     if (event.keyCode == 39) {
        //         box.style.left = box.offsetLeft + 10 + "px"
        //     } else if (event.keyCode == 40) {
        //         box.style.top = box.offsetTop + 10 + "px"
        //     } else if (event.keyCode == 37) {
        //         box.style.left = box.offsetLeft - 10 + "px"
        //     } else {
        //         box.style.top = box.offsetTop - 10 + "px"
        //     }
        // }
    </script>
</body>

</html>